﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace CommModule.Security
{
    public class Hash
    {
        public static String GetStringHash(String toHash)
        {
            SHA256CryptoServiceProvider sha256 = new SHA256CryptoServiceProvider();
            sha256.Initialize();

            byte[] encodedToHash = Encoding.UTF8.GetBytes(toHash);

            byte[] hashedString = sha256.ComputeHash(encodedToHash);

            return Convert.ToBase64String(hashedString);
        }
    }
}
